<template>
  <div>
    <div>{{ a }}</div>
<ul>
  <li v-for="p in person" :key="p.id">{{ p.name }}--{{ p.age }}</li>
</ul>
  </div>
</template>
<script lang="ts" setup name="Person">
import { defineProps,withDefaults } from 'vue';
import {type Persons} from "@/types"
/*接收父亲传递的并保存起来
let per=defineProps(["person","a"])
console.log("@",per);*/

/*只接收不保存
defineProps(["person","a"])*/

// 接收并加限制类型
// defineProps<{person:Persons}>()

//接收+限制类型+限制必要性? 可传可不传+指定默认值withDefaults
withDefaults(defineProps<{person?:Persons}>(),{
  person:()=>[{id:"001",name:"加油",age:20}]
})
</script>
<style>

</style>